import { FILE_TYPE_ENUM } from '@/utils/enum'
import './index.less'

const VideoPlayer = ({ detail }) => {
  return (
    <div className={'video-player ' + detail.type} style={{ height: '100%' }}>
      {detail.type === FILE_TYPE_ENUM.VIDEO ? (
        <video width='100%' height='100%' controls controlsList='nodownload' src={detail.url}>
          您的浏览器不支持 video 标签。
        </video>
      ) : (
        <audio autoPlay={false} controls>
          <source src={detail.url} type='audio/ogg' />
          <source src={detail.url} type='audio/mpeg' />
          您的浏览器不支持 audio 元素。
        </audio>
      )}
    </div>
  )
}

export default VideoPlayer
